package com.qyhl.webtv.module_news.news.goodlife.detail;


import com.qyhl.webtv.commonlib.entity.news.NormalNewsBean;

/**
 * Created by qyhl on 2017/11/27.
 */

public class GoodLifeDetailPresenter implements GoodLifeDetailContract.GoodLifeDetailPresenter {
    private GoodLifeDetailModel mModel;
    private GoodLifeDetailActivity mView;

    public GoodLifeDetailPresenter(GoodLifeDetailActivity mView) {
        this.mView = mView;
        this.mModel = new GoodLifeDetailModel(this);
    }

    @Override
    public void getData(String newsId) {
        mModel.getData(newsId);
    }

    @Override
    public void count(String newsId) {
        mModel.count(newsId);
    }

    @Override
    public void setData(NormalNewsBean bean) {
        mView.setData(bean);
    }

    @Override
    public void setError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 1:
                mView.setError(msg);
                break;
            case 2:
                mView.setEmpty(msg);
                break;
            default:break;

        }
    }
}
